From 79d32b11d5a1c06f38895ce416e781a8f93d7712 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Dj=C3=A4rv?= Date: Thu, 22 Nov 2007 08:41:59 +0000 Subject: [PATCH] (x-gtk-map-stock): Check if FILE is a string. --- lisp/term/x-win.el | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el index 8de5b902e18..cdb4c9711f8 100644 --- a/lisp/term/x-win.el +++ b/lisp/term/x-win.el @@ -2603,15 +2603,18 @@ The list elements are either the symbol name for the alist or the alist itself." (defun x-gtk-map-stock (file) "Map icon with file name FILE to a Gtk+ stock name, using `x-gtk-stock-map'." - (let* ((file-sans (file-name-sans-extension file)) - (key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)" file-sans) - (match-string 1 file-sans))) - (value)) - (mapc (lambda (elem) - (let ((assoc (if (symbolp elem) (symbol-value elem) elem))) - (or value (setq value (assoc-string (or key file-sans) assoc))))) - icon-map-list) - (and value (cdr value)))) + (if (stringp file) + (let* ((file-sans (file-name-sans-extension file)) + (key (and (string-match "/\\([^/]+/[^/]+/[^/]+$\\)" file-sans) + (match-string 1 file-sans))) + (value)) + (mapc (lambda (elem) + (let ((assoc (if (symbolp elem) (symbol-value elem) elem))) + (or value (setq value (assoc-string (or key file-sans) + assoc))))) + icon-map-list) + (and value (cdr value))) + nil)) ;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78 ;;; x-win.el ends here -- 2.30.2